﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Create.Master" Inherits="System.Web.Mvc.ViewPage<Langben.DAL.ts_accpay>" %>

<%@ Import Namespace="Common" %>
<%@ Import Namespace="Models" %>

<asp:Content ID="Content3" ContentPlaceHolderID="CurentPlace" runat="server">
往来帐回款
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<fieldset style="width:320px">
        <legend>往来帐回款 </legend>
        <div  class="bigdiv" style="width:320px">
         <%: Html.HiddenFor(model => model.c_id) %>
         <%: Html.TextBoxFor(model => model.c_paymethod)%> 
         <%: Html.HiddenFor(model => model.dt_dt)%>
        <input type="hidden" id="hidc_id" value='<%: Html.Encode(ViewData["c_id"])%>' />
        <input type="hidden" id="hidc_name" value='<%: Html.Encode(ViewData["c_name"])%>' />
             <table style="width:300px">
             <tr><td width="50px">账号：</td><td width="250px"><input type="text" id="tbc_id" /></td></tr>
             <tr><td>名称：</td><td><input type="text" id="tbc_name" /></td></tr>
             <tr><td>日期：</td><td><input type="text" id="tbdt_dt" /></td></tr>
             <tr> <td>金额：</td><td><%: Html.EditorFor(model => model.f_debit)%></td></tr>
             <tr> <td>发票号：</td><td><%: Html.EditorFor(model => model.c_invno)%> </td></tr>
             <tr> <td>备注：</td><td> <%: Html.EditorFor(model => model.c_comment)%> </td></tr> 
             <tr><td colspan="2" align="center">
             <input class="a2 f2" type="button" value="创建" onclick="save()" />
            <%--<input class="a2 f2" type="button" onclick="BackList('ts_accpay')" value="返回" />--%>
             </td></tr>
             </table>     
        </div>
    </fieldset>
</asp:Content>
 
<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
   <script type="text/javascript">
       $(function () {
           $('#c_id').val($('#hidc_id').val()); 
           $('#tbc_id').val($('#hidc_id').val());
           $('#tbc_id').attr("disabled", true);
           $('#tbc_name').val($('#hidc_name').val());
           $('#tbc_name').attr("disabled", true);
           $('#dt_dt').val(CurentTime());
           $('#tbdt_dt').val(CurentTime());
           $('#tbdt_dt').attr("disabled", true);
       });


       function save() {

           if ($('#f_debit').val() == "0") {
               alert("金额不能为0");
               return;
           }
            
           if (confirm("是否确认调整？")) { 
               $.ajax({
                   url: this.action,
                   type: "Post",
                   data: $(document.forms[0]).serialize(),
                   dataType: "json",
                   success: function (data) {
                       if ($.messager) {
                           $.messager.defaults.ok = '继续';
                           $.messager.defaults.cancel = '返回';

                           $.messager.confirm('操作提示', data, function (r) {
                               if (!r) {
                                   window.location.href = 'javascript:history.go(-1)';
                               }
                           });
                       }

                   }
               });
           }
       }


       function CurentTime() {
           var now = new Date();

           var year = now.getFullYear();       //年
           var month = now.getMonth() + 1;     //月
           var day = now.getDate();            //日

           var hh = now.getHours();            //时
           var mm = now.getMinutes();          //分

           var clock = year + "-";

           if (month < 10)
               clock += "0";

           clock += month + "-";

           if (day < 10)
               clock += "0";

           clock += day + " ";

           if (hh < 10)
               clock += "0";

           clock += hh + ":";
           if (mm < 10) clock += '0';
           clock += mm;
           return (clock);
       } 
   </script>
</asp:Content>
